package web_pro;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class yd_fl {
	private String fl_name="";
	private String fl_img="";
	private String fl_id="";
	private String dz_top="";
	private String dz_bottom = "";
	public String getname() {
		return fl_name;
	}
	public void setname(String name) {
		fl_name = name;
	}
	public String getimg() {
		return fl_img;
	}
	public void setimg(String img) {
		fl_img = img;
	}
	public String getimg2() {
		return fl_id;
	}
	public void setimg2(String id) {
		fl_id = id;
	}
	public String getdz_top() {
		return dz_top;
	}
	public void setdz_top(String dz_) {
		dz_top = dz_;
	}
	public String getdz_bo() {
		return dz_bottom;
	}
	public void setdz_bo(String dz_b) {
		dz_bottom = dz_b;
	}
	public String fl_data_1() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from fl_data_1";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"fl_name\":\""+rs.getString("fl_name") +"\",\"fl_img\":\""+rs.getString("fl_img")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String fl_data_2() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from fl_data_2";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"fl_name\":\""+rs.getString("fl_name") +"\",\"fl_img\":\""+rs.getString("fl_img")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String fl_data_3() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from fl_data_3";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"fl_name\":\""+rs.getString("fl_name") +"\",\"fl_img\":\""+rs.getString("fl_img")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String wd_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from wd_data ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"fl_name\":\""+rs.getString("fl_name") +"\",\"fl_img\":\""+rs.getString("fl_img")+"\",\"fl_id\":\""+rs.getString("fl_id")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String dz_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from dz_data ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"dz_top\":\""+rs.getString("dz_top") +"\",\"dz_bottom\":\""+rs.getString("dz_bottom")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String dz_data_add(String userdzq,String userdzw,String userName,String userIphone) {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str="insert into dz_data_2(dz_dzq,dz_dzw,dz_ren,dz_iphone)";
    	
     	Sql_str+=" values('"+userdzq+"','"+userdzw+"','"+userName+"','"+userIphone+"')";
     	
//    	Sql_str+=" values(2,3,"+userName+","+userIphone+")";
//		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			int result = pstat.executeUpdate();
			if(result!=0) {
				
			}
//			while(rs.next())  
//	            {
//						json01= json01+"{\"dz_top\":\""+rs.getString("dz_top") +"\",\"dz_bottom\":\""+rs.getString("dz_bottom")+"\"},";
//						
//				}
//			json01=json01+"]";
//			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
//    	json01 = json01.replace("},]", "}]");
		return null;

	}
	public String sdz_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from dz_data_2 ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"dz_ren\":\""+rs.getString("dz_ren") +"\",\"dz_iphone\":\""+rs.getString("dz_iphone")+"\",\"dz_dzq\":\""+rs.getString("dz_dzq")+"\",\"dz_dzw\":\""+rs.getString("dz_dzw")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String zz_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from zz_data ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"zz_img\":\""+rs.getString("zz_img") +"\",\"zz_name\":\""+rs.getString("zz_name")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String sy_zz_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from sy_zz_data ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"fl_name\":\""+rs.getString("fl_name") +"\",\"fl_img\":\""+rs.getString("fl_img")+"\",\"fl_id\":\""+rs.getString("fl_id")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String tj_zz_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from zz_xx ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"zz_e_name\":\""+rs.getString("zz_e_name") +"\",\"zz_img\":\""+rs.getString("zz_img")
						+"\",\"zz_c_name\":\""+rs.getString("zz_c_name")
						+"\",\"zz_dq\":\""+rs.getString("zz_dq")
						+"\",\"zz_jj\":\""+rs.getString("zz_jj")
								+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String book_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from book_data ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
				json01= json01+"{\"book_name\":\""+rs.getString("book_name")+"\",\"book_jg\":\""+rs.getString("book_jg")+"\",\"book_zz\":\""+rs.getString("book_zz")+"\",\"book_yz\":\""+rs.getString("book_yz")+"\",\"book_cbs\":\""+rs.getString("book_cbs")+"\",\"book_js\":\""+rs.getString("book_js")+"\",\"book_img\":\""+rs.getString("book_img")
						+"\"},";
				
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String gw_data() {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from sp_add ";
		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {
						json01= json01+"{\"sp_name\":\""+rs.getString("sp_name") +"\",\"sp_img\":\""+rs.getString("sp_img")+"\",\"sp_jg\":\""+rs.getString("sp_jg")+"\"},";
						
				}
			json01=json01+"]";
			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
    	json01 = json01.replace("},]", "}]");
		return json01;

	}
	public String sp_add(String userdzq,String userdzw,String userName) {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str="insert into sp_add(sp_name,sp_jg,sp_img)";
    	
     	Sql_str+=" values('"+userdzq+"','"+userdzw+"','"+userName+"')";
     	
//    	Sql_str+=" values(2,3,"+userName+","+userIphone+")";
//		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			int result = pstat.executeUpdate();
			if(result!=0) {
				
			}
//			while(rs.next())  
//	            {
//						json01= json01+"{\"dz_top\":\""+rs.getString("dz_top") +"\",\"dz_bottom\":\""+rs.getString("dz_bottom")+"\"},";
//						
//				}
//			json01=json01+"]";
//			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
//    	json01 = json01.replace("},]", "}]");
		return null;

	}
	public String sp_sc(String sp_name) {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str="delete from sp_add where sp_name = '"+sp_name+"'";
    	
     	
     	
//    	Sql_str+=" values(2,3,"+userName+","+userIphone+")";
//		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			int result = pstat.executeUpdate();
			if(result!=0) {
				
			}
//			while(rs.next())  
//	            {
//						json01= json01+"{\"dz_top\":\""+rs.getString("dz_top") +"\",\"dz_bottom\":\""+rs.getString("dz_bottom")+"\"},";
//						
//				}
//			json01=json01+"]";
//			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
//    	json01 = json01.replace("},]", "}]");
		return null;

	}
	public String dz_sc(String dz_name) {
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str="delete from dz_data_2 where dz_ren = '"+dz_name+"'";
    	
     	
     	
//    	Sql_str+=" values(2,3,"+userName+","+userIphone+")";
//		String json01="[";
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			int result = pstat.executeUpdate();
			if(result!=0) {
				
			}
//			while(rs.next())  
//	            {
//						json01= json01+"{\"dz_top\":\""+rs.getString("dz_top") +"\",\"dz_bottom\":\""+rs.getString("dz_bottom")+"\"},";
//						
//				}
//			json01=json01+"]";
//			System.out.print(json01);
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
//    	json01 = json01.replace("},]", "}]");
		return null;

	}
	boolean dl(String Vlog,String Vpwd){
	 	   boolean loginok=false;
	 	   Connection  conn = (Connection) pub_fun.getConnection();
	    	String Sql_str = "select * from xcx_login where log='"+Vlog+"' and pwd='"+Vpwd+"'" ;
	    	String Ostr="";
	    	boolean Oboolean=false;
	    	try {
				PreparedStatement pstat = (PreparedStatement) conn.prepareStatement(Sql_str);
				ResultSet rs = (ResultSet) pstat.executeQuery();
				while(rs.next())  
		            {  
	 				     loginok=true;
					}  
		        pstat.close();
		        conn.close();

	 
	        } catch (SQLException e) {
	            e.printStackTrace();
	        }
	    	System.out.println(loginok);
			
	 	   return loginok;
	    }
}
